class Nest(object):

    def __init__(self, meta_type=None, path_parser_type=None):
        # Assert type constraints.
        import meta
        import path.parser
        if not issubclass(path_parser_type, path.parser.PathParser):
            raise TypeError('Wrong type of path parser.')
        if not issubclass(meta_type, meta.Meta):
            raise TypeError('Wrong type of meta object.')
        # Initialize nest object.
        self.meta_type = meta_type
        self.path_parser_type = path_parser_type

    def sample(self, *arg, **kwds):
        kwds.update(dict(nest = self))
        return self.meta_type(*arg, **kwds)
    
    def path(self, *arg, **kwds):
        return self.path_type(arg, kwds)

